package com.optimize_01;

import com.optimize_01.service.impl.CurrentConditionsDisplay;
import com.optimize_01.service.impl.StatisticsDisplay;

public class TemperatureDemo {

    public static void main(String[] args) {
        WeatherData weatherData = new WeatherData();
        // 注册
        new CurrentConditionsDisplay(weatherData);
        // 注册
        StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData);
        // 数据发生改变
        weatherData.setMeasurements(45.2F,56.4F,78.5F);

        // 移除注册
        weatherData.removeObserver(statisticsDisplay);
        // 数据发生改变
        weatherData.setMeasurements(41.2F,26.4F,91.5F);
    }
}
